import {CardType} from '../../../common/cards/CardType';
import {CardName} from '../../../common/cards/CardName';
import {CardRenderer} from '../render/CardRenderer';
import {Tag} from '../../../common/cards/Tag';
import {ActionCard} from '../ActionCard';
import {digit} from '../Options';

export class GreyMarketExploitation extends ActionCard {
  constructor() {
    super({
      type: CardType.ACTIVE,
      name: CardName.GREY_MARKET_EXPLOITATION,
      tags: [Tag.CRIME],
      cost: 4,

      requirements: {corruption: 2},

      action: {
        or: {
          behaviors: [
            {
              spend: {megacredits: 1},
              standardResource: 1,
              title: 'Spend 1 M€ to gain 1 standard resource.',
            },
            {
              spend: {corruption: 1},
              standardResource: 3,
              title: 'Spend 1 corruption to gain 3 of the same standard resource.',
            },
          ],
          autoSelect: true,
        },
      },

      metadata: {

        cardNumber: 'U034',
        renderData: CardRenderer.builder((b) => {
          b.action('Spend 1 M€ to gain 1 standard resource.',
            (ab) => ab.megacredits(1).startAction.wild(1).asterix()).br;
          b.action('Spend 1 corruption to gain 3 of the same standard resource.',
            (ab) => ab.or().corruption(1).startAction.wild(3, {digit}).asterix()).br;
        }),
        description: 'Requires 2 corruption.',
      },
    });
  }
}
